const { Random } = require("mockjs")
const Mock = require("mockjs")
const User = require("../model/User")
const md5 = require("md5")


//创建数据的函数
async function userData() {
  //酒店列表数据
  const { userList } = Mock.mock({
    "userList|20": [
      {
        userId: "@id",
        username: "@word(5)",
        password: "md5(12345)",
        phone: /^1[3456789]\d{9}$/,
        avatar: "",
        "gender|1": ["男", "女"],
        "age|20-30": 1,
        hometown: "@county(true)",
        "industry|10-30": "@cword()",
        hobby: "@cword(12)",
        like:0,
       "isAdmin|1-2":false,
      },
    ],
  });
  const res = await Promise.all(
    userList.map((item) => {
      // console.log(item);
      return User.create(item)
    })
  )
}


module.exports = userData